<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="content-type" content="text/html; charset=utf-8">
    <meta name="renderer" content="webkit" />
    <meta name="force-rendering" content="webkit" />
    <title>设置密码</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    <meta name="viewport"
        content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="stylesheet" href="css/shop.css">
    <link rel="stylesheet" href="css/weui.min.css">
    <link rel="stylesheet" href="css/jquery-weui.min.css">
    <script src="js/jquery-2.1.4.js"></script>
    <script src="js/jquery-weui.js"></script>
    <script type="text/javascript" src="js/city-picker.js" charset="utf-8"></script>
    <script src="wxJs/utils/contain.js"></script>
    <script src="wxJs/utils/storage.js"></script>
</head>
<style>
    .header{
        background-color: #6670FF;
    }
</style>
<body>
    <div class="header">
        <a class="haader-left" href="javascript:window.history.go(-1)"><i class="iconfont icon-left"></i></a>
        <div class="haader-content">设置密码</div>
        <div class="haader-right">
        </div>
    </div>
    <div style="background-color: #fff;" class="mt10">
        <div class="weui-cell">
            <div class="weui-cell__hd"><label class="weui-label">密码</label></div>
            <div class="weui-cell__bd">
                <input class="weui-input" type="password" placeholder="请输入密码" id="mima1"  maxlength="6" oninput="setNumType(this)">
            </div>
        </div>
        <div class="weui-cell">
            <div class="weui-cell__hd"><label class="weui-label">确认密码</label></div>
            <div class="weui-cell__bd">
                <input class="weui-input" type="password" placeholder="请确认密码" id="mima2"  maxlength="6" oninput="setNumType(this)">
            </div>
        </div>
    </div>
    <div class="btn-contain">
        <a href="javascript:;" class="weui-btn weui-btn_primary mt10 tijiao">保存</a>
    </div>
</body>
<script>
    var userId = GetQueryString("userId");
    if (!userId || userId==0) {
        window.history.back(-1);
    }
    $('.tijiao').on("click",function () {
        var mima1 = $("#mima1").val().trim()
        var mima2 = $("#mima2").val().trim()
        if (mima1 && mima2 && mima1 == mima2){
            $.post(getWeiContextPath()+"/wx/VipUser/setPayNumber",{wxUserId:userId,payNumber:mima1},function (res) {
                $.toast("密码设置成功",function () {
                    window.location.replace("me.html?userId="+userId)
                })
            })
        }else {
            $.toast("请确认密码的输入", "forbidden")
        }
    })
    /*只能输入数字*/
    function setNumType(_this) {
        var num = $(_this).val()
        $(_this).val(num.replace(/[^\d]/g,''))
    }

</script>
</html>